autoprefixer = require 'gulp-autoprefixer'
concat       = require 'gulp-concat'
gulp         = require 'gulp'
minifyCss    = require 'gulp-minify-css'
paths        = require('../config.coffee').paths
prefixCfg    = require('../config.coffee').prefixConfig
sassStream   = require '../utils/sassStream.coffee'
rev          = require 'gulp-rev'

gulp.task 'styles-optimize', ->
    gulp.src(paths.styles)
        .pipe sassStream()
        .pipe autoprefixer(prefixCfg)
        .pipe(minifyCss())
        .pipe(concat('app.css'))
        .pipe rev()
        .pipe(gulp.dest(paths.dest))
        .pipe rev.manifest()
        .pipe(gulp.dest('rev/css'))
